<template>
    <div>
        <div class="common-form">
            <span>新人商品组</span>
        </div>
        <el-form size="small" :model="curItem" label-width="100px">
            <!-- 上边距 -->
            <el-form-item label="上边距：">
                <el-slider v-model="curItem.style.paddingTop" show-input></el-slider>
            </el-form-item>
            <!-- 顶部图片 -->
            <el-form-item label="顶部图片：">
              <div class="diy-New-cover-top">
                <img v-img-url="curItem.style.topimage" alt="" @click="$parent.onEditorSelectImage(curItem.style, 'topimage')" style="background-color: #eee;">
              </div>
              <div>建议尺寸90×90 - 210x90</div>
            </el-form-item>
            <!-- 更多文字 -->
            <el-form-item label="更多文字：">
                <el-input v-model="curItem.params.moretext" class="w-auto"></el-input>
                <div>最多5个文字</div>
            </el-form-item>
            <!-- 链接地址 -->
            <el-form-item label="活动地址：">
              <div class="d-s-c">
                <div class="url-box flex-1">
                  <el-input placeholder="请选择链接地址" v-model="curItem.params.name"></el-input>
                </div>
                <div class="url-box ml10">
                  <el-button type="primary" @click="changeLink(index)">选择链接</el-button>
                </div>
              </div>
            </el-form-item>
            <!--显示数量-->
            <!-- <el-form-item label="显示数量：">
                <el-input v-model="curItem.params.showNum" class="w-auto"></el-input>
            </el-form-item> -->
            <!-- 文字颜色 -->
            <!-- <el-form-item label="时间颜色：">
                <div class="d-s-c">
                    <el-color-picker v-model="curItem.style.countdown_color"></el-color-picker>
                    <el-button type="button" style="margin-left: 10px;"
                        @click.stop="$parent.onEditorResetColor(curItem.style, 'countdown_color', '#ff4c01')">重置
                    </el-button>
                </div>
            </el-form-item>
            <el-form-item label="价格颜色：">
                <div class="d-s-c">
                    <el-color-picker v-model="curItem.style.color"></el-color-picker>
                    <el-button type="button" style="margin-left: 10px;"
                        @click.stop="$parent.onEditorResetColor(curItem.style, 'color', '#ff4c01')">重置
                    </el-button>
                </div>
            </el-form-item>
            <el-form-item label="时间背景颜色：">
                <div class="d-s-c">
                    <el-color-picker v-model="curItem.style.countdown_back_color"></el-color-picker>
                    <el-button type="button" style="margin-left: 10px;"
                        @click.stop="$parent.onEditorResetColor(curItem.style, 'countdown_back_color', '#fef7e4')">重置
                    </el-button>
                </div>
            </el-form-item>
            <el-form-item label="背景颜色：">
                <div class="d-s-c">
                    <el-color-picker v-model="curItem.style.background_color"></el-color-picker>
                    <el-button type="button" style="margin-left: 10px;"
                        @click.stop="$parent.onEditorResetColor(curItem.style, 'background_color', '#ff4c01')">重置
                    </el-button>
                </div>
            </el-form-item>
            <el-form-item label="背景顶部图片：">
              <div class="diy-notice-icon">
                <img v-img-url="curItem.style.background_image" alt="" @click="$parent.onEditorSelectImage(curItem.style, 'background_image')">
              </div>
              <div>建议尺寸710×90</div>
            </el-form-item>
            <el-form-item label="倒计时脚标：">
              <div class="diy-notice-icon">
                <img v-img-url="curItem.style.top_image" alt="" @click="$parent.onEditorSelectImage(curItem.style, 'top_image')">
              </div>
              <div>建议尺寸102×38</div>
            </el-form-item> -->
        </el-form>

        <Setlink v-if="is_linkset" :is_linkset="is_linkset" @closeDialog="closeLinkset">选择链接</Setlink>
    </div>

</template>

<script>
  import Setlink from '@/components/setlink/Setlink';
  export default {
      components: {
        Setlink
      },
        data() {
            return {
              /*是否选择链接*/
              is_linkset: false,
              index: null
            };
        },
        props: ['curItem', 'selectedIndex'],
        created() {

        },
        methods: {
          /*选择链接*/
          changeLink(index) {
            this.is_linkset = true;
            this.index = index;
          },
          
          /*获取链接并关闭弹窗*/
          closeLinkset(e) {
            this.is_linkset = false;
            if (e) {
              this.curItem.params.linkUrl = e.url;
              this.curItem.params.name = '链接到' + ' ' + e.type + ' ' + e.name;
            }
          }
        }
    };
</script>

<style>
  .diy-New-cover-top>img{
    /* width: 120px; */
    height: 45px;
  }
</style>
